package com.java.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.java.po.Grade;
import com.java.po.GradeMap;
import com.java.po.Message;
import com.java.po.MessageMap;
import com.java.service.GradeService;
import com.java.service.MessageService;
import com.java.service.impl.GradeServiceImpl;
import com.java.service.impl.MessageServiceImpl;
import com.java.tool.AjaxJson;

/**
 * Title:GradeController.java
 * Description:
 * @author:sprogrammer
 * @time:2018年3月13日下午3:43:02
 */
@Controller
@CrossOrigin()
@RequestMapping(method=RequestMethod.POST)
public class GradeController {
	private AjaxJson ajaxJson;
	@Autowired
	private GradeService gradeService;
	
	public GradeController(){
		ajaxJson = new AjaxJson();
		//service = new GradeServiceImpl();
	}
	
	@RequestMapping(value="/insertGrade")
	public @ResponseBody AjaxJson insertGrade(@RequestBody Grade grade) throws Exception{
		ajaxJson=gradeService.insertGrade(grade);
		return ajaxJson;
	}
	@RequestMapping(value="/updateGrade")
	public @ResponseBody AjaxJson updateGrade(@RequestBody Grade grade) throws Exception{
		ajaxJson=gradeService.updateGrade(grade);
		return ajaxJson;
	}
	@RequestMapping(value="/deleteGrade")
	public @ResponseBody AjaxJson deleteGrade(@RequestBody Grade grade) throws Exception{
		ajaxJson=gradeService.deleteGrade(grade);
		return ajaxJson;
	}
	@RequestMapping(value="/findAllGrade")
	public @ResponseBody AjaxJson findAllGrade(@RequestBody GradeMap gradeMap) throws Exception{
		ajaxJson=gradeService.findAllGeade(gradeMap);
		return ajaxJson;
	}
	@RequestMapping(value="/findGradeByid")
	public @ResponseBody AjaxJson findGradeByid(@RequestBody Grade grade) throws Exception{
		ajaxJson=gradeService.findGradeByid(grade);
		return ajaxJson;
	}

}
